﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;

namespace BigVisibleCountdown
{
    public class TimeDisplayColorConverter : IValueConverter
    {

        //TODO: Need to clean this up. Very hacked together.

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var clock = value as CountdownTimer;
            var useColor = new SolidColorBrush(Colors.White);

            if (clock.Hours == 0 && clock.Minutes < 2)
            {
                useColor = new SolidColorBrush(Colors.Yellow);
            }

            if (clock.Hours <= 0 && clock.Minutes <= 0 && clock.Seconds <= 0)
            {
                useColor = new SolidColorBrush(Colors.Red);
            }

            return useColor;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }
    }
}
